Managing code when communicating using heirarchically-structured data

ABSTRACT

A description of the hierarchically-structured document is accessed and converted into an early-bound object having at least some of the same properties as the hierarchically-structured document, and having at least some of the methods that may be performed on the hierarchically-structured document. When a function call is placed to the early-bound object, the early-bound object causes the appropriate corresponding changes to be affected on the hierarchically-structured document while maintaining change tracking information for the document. This reduces the difficulty when drafting source code for a program that interfaces with hierarchically-structured documents that can have varying structures and may be governed by complex change tracking rules.

BACKGROUND OF THE INVENTION

1. The Field of the Invention

The present invention relates to mechanisms for facilitating softwareprogramming; and more specifically, to simplifying the programmingprocess by using managed code that hides much of the complexity ofhierarchically-structured data when communicating using thehierarchically-structured data.

2. Related Technology

Computing technology has transformed the way we work and play. Computersconsist of hardware components such as for, example, processors andmemory capability. However, much of the utility of a typicalgeneral-purpose computing system is derived from the capabilities of thesoftware that is available to the computing system, whether thatsoftware is locally available, or whether that software is accessedremotely over a network.

Software includes computer-executable instructions that are executed bya processor to thereby cause the processor to control various functionsof the computing system. Modern computing systems may perform anextensive variety of complex actions depending on what thecomputer-executable instructions tell the processor to do. At the lowestphysical level of the computing system as viewed from the processorperspective, the computer-executable instructions are essentially astring of one's and zero's that conform to an instruction set that isrecognized by the processor. These processor-level instructions areoften referred to as “binaries” or “binary instructions”.

While binaries are quickly interpretable by processors, they are lessintuitive to human beings. Accordingly, software programs are notinitially drafted using binary instructions. Instead, software programsare typically first drafted using a more intuitive, human-readablelanguage called “source code.” For example, VISUAL BASIC, C++ and DB.NETare all languages used for drafting source code, each containing manywords that are adopted from the English language, letters that are takenfrom the familiar Latin-based alphabet, and mathematical numbers andsymbols that are commonly accepted for human expressions of mathematicalconcepts. While source code is interpretable by human beings, processors(and computer systems) need binary instructions in order to functionproperly.

Some software, such as compilers and interpreters, convert source codeto corresponding binary instructions that perform the same functionality(when executed by a processor) as was represented by the source code.Accordingly, source code allows for human programmers to author programsthat would otherwise not be possible. While source code facilitatesprogramming and is typically readable by programmers with sufficienttraining, source code can still be quite difficult to draft especiallyfor complex programs.

Program complexity is often measured in terms of “lines of code”. Manyprograms number in the thousands of lines of code. Accordingly, evenwith the most skilled of programmers, there are often initially errorsin the source code that prohibit successful compilation. Even when theseerrors are discovered and corrected resulting in successful compilation,there are often unintended functionality (often referred to as “bugs”)that are present in the program. The difficulty in compiling a program,and the probability of introducing unintended functionality into theprogram, tends to increase the more the lines of code there are in theprogram. Accordingly, methods have been developed to manage code tothereby simplify the source code needed to accomplish givenfunctionality.

One conventional way of doing this is to organize functional componentsof the program into segments often referred to as “objects”. Theseobjects have corresponding properties and corresponding methods that maybe invoked. Objects may communicate using standards called ApplicationProgram Interfaces (APIs). Objects may communicate locally or evenremotely over a network using APIs.

For example, recently, the use of eXtenstible Markup Language (XML) hasbecome more accepted as a way to communicate between objects. Whenremotely communicating over a network, sometimes Simple Object AccessProtocol (SOAP) is used as a mechanism to transport an XML documentbetween different network sites. According to convention, the XMLdocument may be transmitted as an XML document within the body portionof a SOAP envelope.

XML is useful partly because of its organization as ahierarchically-structured tree of nodes, each node comprising a tag thatmay contain descriptive attributes. XML is also useful because of itsability to follow extendable patterns that may be dictated by theunderlying data being described. For example, a contact may have onepattern or schema, while a calendar entry may have a very differentpattern or schema. As the need to describe certain aspects of theseitems arises, the pattern may be extended to include nodes that describesuch aspects of the item. Accordingly, XML is gaining acceptance as amethod for communicating data.

Some APIs involve the manipulation of XML documents following aparticular schema. Because of the wide variety of items that may bedescribed using XML, there are a wide variety of XML schemas. In can berelatively difficult for many programmers to keep track of the structureof a particular schema when they desire to draft code that manipulates adata item that is described by the XML document. There may also be otherintricacies of an API that involves operations on XML documents. Forexample, perhaps only portions of the XML may be operated on as anatomic entity. Adding to the complexity, perhaps it is necessary notonly to track changes to the XML document as a whole, but perhaps toeach atomic portion of the XML document that may be separately operatedupon. Thus, it can be a difficult task for many programmers to dealdirectly with the hierarchically-structured XML document.

BRIEF SUMMARY OF THE INVENTION

The principles of the present invention relate to mechanisms forallowing a programmer to draft source code that manipulates ahierarchically-structured document without requiring that the programmerdraft source code that specifically references the structure (e.g.related to change tracking) of the hierarchically-structured document.In one embodiment, the principles of the present invention areimplemented in a network environment in which a client is networkconnectable to a variety of network services such as, for example, webservices. Each service maintains hierarchically-structured documents(e.g., XML documents) that are valid with respect to one or moreschemas. For example, there might be one web or other network servicethat maintains XML documents that follow a particular pattern or schemafor contact information, another service that maintains XML documentsthat follow a particular schema for calendar information, and so forth.Also, modifications to the document may be performed without needing todownload the entire document, modify it, and upload the completedocument back to the service.

There are several factors that may make it convenient for a programmerto not have to deal directly with the structure of ahierarchically-structured document in such an environment. For example,since there are many different types of things that may be described byan XML document, there may potentially be many standardized schemas thatmay be followed for a variety of different network services.Accordingly, when drafting a program that is to interface withhierarchically-structured documents, a programmer that directlyinterfaces with hierarchically-structured documents would need to haveknowledge of which particular schema the document follows, as well ashow the schema is organized. In addition, the programmer would need todeal with the potentially cumbersome process of programming to a raw XMLprogramming model.

Also, in many cases, there may be standard methods that are used whenallowing the client to manipulate the content of (or query) any XMLdocument, no matter what schema the XML document follows. These methodsprovide the means for changes made locally on the client application tobe communicated to the XML document managed by the service. For example,regardless of whether the XML document follows a calendar schema, awallet schema, a contacts schema, or an application setting schema,certain methods such as insert, delete, query, replace, or update may becommon for all of the schemas due to the generic nature of the methods.These method calls may be complex and cumbersome to construct directlyas they are themselves expressed in XML, and parsing the responses isalso complex since they are XML too. Furthermore, there may also becustomized methods that are tailored to each of the schemas. It mayrequire some study for programmers to keep track of what custom methodsare offered for the particular schema(s) that they are interfacing with.The methods may have common security behaviors related to, for example,encryption, authentication, digital signatures and the like. Thesesecurity behaviors may be cumbersome and complex to program directly.They also may have common headers (e.g., SOAP headers when the methodsare SOAP methods) which are routine but tedious to program directly.Programmers can be relieved of all of these tasks.

Furthermore, in order to reduce the variety of requests that the servicewould have to deal with, it may be that only portions of thehierarchically-structured document may be operated upon as an atomicentity. For example, when changing the area code of a telephone numberfor a given person in a contacts list, it may be necessary to submit areplacement telephone numbers XML segment for that contact that re-listsall of the relevant telephone numbers for the contact, but with thecorrect area code inserted for the telephone number that is to becorrected. Keeping track of these modifications rules (e.g., of whatcan, and cannot, be operated upon as an atomic entity) would requiretime for studying the schema. Rather than invest such time, programmersmay instead choose to replace the entire XML document, instead of justthe particular atomic XML segment(s) of relevance, thereby resulting ina waste of processing and bandwidth resources. This might also result inupdates from other clients being overwritten, even though the clientthat caused the overwriting did not intend to do so.

Finally, the different atomic entities of the XML document that may beseparately operated upon may have their own change tracking information.While working with the XML document, the programmer would have to trackany changes to the document and then synthesize those changes into achange unit consistent with the modification rules when the changes needto be applied to the service.

This is not to say that a programmer may not become well-familiar withhow to draft source code that interfaces directly with the structure ofthe hierarchically-structured document with some effort, but the presentinvention makes it easier for the programmer by no longer requiring thatthe programmer draft source code that directly interfaces with thestructure of the hierarchically-structured document or manage changetracking by himself.

Instead, a description of the hierarchically-structured document of thesame class as the hierarchically-structured document is accessed byprogramming tools in accordance with the present invention. For example,Web Services Description Language (WSDL) is an XML-formatted languagethat is use to describe a service's capabilities and, in particular, themethods exposed by the service. Another type of description language maybe, for example, an XML Schema Description (XSD) document. An XSDdocument defines the structure of the data that is passed in and out ofthe methods described by the WSDL document.

The description document is then converted into at least one early-boundobject having at least some of the same properties as thehierarchically-structured document, and having at least some of themethods that may be performed on the hierarchically-structured document.In one embodiment, the description is converted into two types ofobjects specific to the service that it describes, a connection objectthat embodies the methods that can be invoked on the service, and dataobjects that embody the data types that are passed in and out of thosemethods. These early-bound data objects correspond to the structure ofthe hierarchically-structured document and know how to track changes tothe document, consistent with the change-tracking rules associated withthe document structure.

Early-bound objects are quite familiar to most programmers. Accordingly,software programmers are often more comfortable drafting source codethat interfaces with an early-bound object, than to a hierarchicallystructured XML document.

When modifications are made to the properties of the early-bound object,the early-bound object can cause the appropriate corresponding changesto be effected on the underlying hierarchically-structured document. Todo this, the object needs to communicate only the incremental changes tothe service since the object itself tracks changes. The object mayinterface with other functions through, for example, a Dynamic LinkLibrary (DLL) file for functions that are more common. Functions thatare either directly implemented by the object or that are indirectlyimplemented via, for example, a DLL file may keep track of the structureof the hierarchically-structured document, what portions of the documentmay be operated upon as an atomic entity, and how to maintain changetracking information. Accordingly, the programmer need not be concernedabout all of those details. This makes it easier for the programmer todeal in an environment in which the program is to interface with suchhierarchically-structured documents since the programmer only has todraft source code to interface with the familiar form of an early-boundobject.

Additional features and advantages of the invention will be set forth inthe description which follows, and in part will be obvious from thedescription, or may be learned by the practice of the invention. Thefeatures and advantages of the invention may be realized and obtained bymeans of the instruments and combinations particularly pointed out inthe appended claims. These and other features of the present inventionwill become more fully apparent from the following description andappended claims, or may be learned by the practice of the invention asset forth hereinafter.

BRIEF DESCRIPTION OF THE DRAWINGS

In order to describe the manner in which the above-recited and otheradvantages and features of the invention can be obtained, a moreparticular description of the invention briefly described above will berendered by reference to specific embodiments thereof which areillustrated in the appended drawings. Understanding that these drawingsdepict only typical embodiments of the invention and are not thereforeto be considered to be limiting of its scope, the invention will bedescribed and explained with additional specificity and detail throughthe use of the accompanying drawings in which:

FIG. 1 illustrates a suitable computing system in which the principlesof the present invention may be employed.

FIG. 2 illustrates a more specific architecture in which the principlesof the present invention may be employed.

FIG. 3 illustrates a network environment that includes a number ofclients and a number of services, each service maintaining documents ofa particular pattern or schema.

FIG. 4 schematically illustrates a logical flow of data involved withdrafting a program that interfaces with a hierarchically-structureddocument without requiring source code that directly interfaces with thehierarchically-structured document.

FIG. 5 illustrates a method in accordance with the invention forallowing a programmer to more easily draft source code for a programthat interfaces with hierarchically-structured documents.

DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS

The principles of the present invention relate to mechanisms forallowing a programmer to draft source code that manipulates ahierarchically-structured document without requiring that the programmerdraft source code that specifically references the structure of thehierarchically-structured document. Instead, a description of thehierarchically-structured document of the same class as thehierarchically-structured document is accessed and converted into one ormore early-bound objects having at least some of the same properties asthe hierarchically-structured document, and having at least some of themethods that may be performed on the hierarchically-structured document.These early-bound objects correspond to the structure of the XMLdocument and know how to track changes to the document, consistent withthe change-tracking rules associated with the document structure.

When a function call is placed to the early-bound object, theearly-bound object causes the appropriate corresponding changes to beaffected on the hierarchically-structured document while maintainingchange tracking information for the document. This reduces thedifficulty when drafting source code for a program that interfaces withhierarchically-structured document that can have varying structures andmay be governed by complex change tracking rules.

Embodiments within the scope of the present invention includecomputer-<readable media for carrying or having computer-executableinstructions or data structures stored thereon. Such computer-readablemedia can be any available media which can be accessed by a generalpurpose or special purpose computer. By way of example, and notlimitation, such computer-readable media can comprise physicalcomputer-readable media such as RAM, ROM, EEPROM, CD-ROM or otheroptical disk storage, magnetic disk storage or other magnetic storagedevices, or any other medium which can be used to carry or store desiredprogram code means in the form of computer-executable instructions ordata structures and which can be accessed by a general purpose orspecial purpose computer.

When information is transferred or provided over a network or anothercommunications connection (either hardwired, wireless, or a combinationof hardwired or wireless) to a computer, the computer properly views theconnection as a computer-readable medium. Thus, any such a connection isproperly termed a computer-readable medium. Combinations of the aboveshould also be included within the scope of computer-readable media.Computer-executable instructions comprise, for example, instructions anddata which cause a general purpose computer, special purpose computer,or special purpose processing device to perform a certain function orgroup of functions.

FIG. 1 and the following discussion are intended to provide a brief,general description of a suitable computing environment in which theinvention may be implemented. Although not required, the invention willbe described in the general context of computer-executable instructions,such as program modules, being executed by computers in networkenvironments. Generally, program modules include routines, programs,objects, components, data structures, and the like, that performparticular tasks or implement particular abstract data types.

Those skilled in the art will appreciate that the invention may bepracticed in network computing environments with many types of computersystem configurations, including personal computers, hand-held devices,multi-processor systems, microprocessor-based or programmable consumerelectronics, network PCs, minicomputers, mainframe computers, and thelike. The invention may also be practiced in distributed computingenvironments where tasks are performed by local and remote processingdevices that are linked (either by hardwired links, wireless links, orby a combination of hardwired or wireless links) through acommunications network. In a distributed computing environment, programmodules may be located in both local and remote memory storage devices.

With reference to FIG. 1, an exemplary system for implementing theinvention includes a general purpose computing device in the form of aconventional computer 120, including a processing unit 121, a systemmemory 122, and a system bus 123 that couples various system componentsincluding the system memory 122 to the processing unit 121. Throughoutthis description, element numbers begin with the same number as thefigure in which the corresponding elements were first introduced. Forexample, all of the element numbers in FIG. 1 are numbered in the 100'swhile the element numbers in FIG. 2 are number in the 200's, and soforth. If the same element is re-illustrated in subsequent drawings,however, the corresponding reference number will remain the same.

The system bus 123 may be any of several types of bus structuresincluding a memory bus or memory controller, a peripheral bus, and alocal bus using any of a variety of bus architectures. The system memoryincludes read only memory (ROM) 124 and random access memory (RAM) 125.A basic input/output system (BIOS) 126, containing the basic routinesthat help transfer information between elements within the computer 120,such as during start-up, may be stored in ROM 124.

The computer 120 may also include a magnetic hard disk drive 127 forreading from and writing to a magnetic hard disk 139, a magnetic diskdrive 128 for reading from or writing to a removable magnetic disk 129,and an optical disk drive 130 for reading from or writing to removableoptical disk 131 such as a CD-ROM or other optical media. The magnetichard disk drive 127, magnetic disk drive 128, and optical disk drive 130are connected to the system bus 123 by a hard disk drive interface 132,a magnetic disk drive-interface 133, and an optical drive interface 134,respectively. The drives and their associated computer-readable mediaprovide nonvolatile storage of computer-executable instructions, datastructures, program modules and other data for the computer 120.Although the exemplary environment described herein employs a magnetichard disk 139, a removable magnetic disk 129 and a removable opticaldisk 131, other types of computer readable media for storing data can beused, including magnetic cassettes, flash memory cards, digital videodisks, Bernoulli cartridges, RAMs, ROMs, and the like.

Program code means comprising one or more program modules may be storedon the hard disk 139, magnetic disk 129, optical disk 131, ROM 124 orRAM 125, including an operating system 135, one or more applicationprograms 136, other program modules 137, and program data 138. A usermay enter commands and information into the computer 120 throughkeyboard 140, pointing device 142, or other input devices (not shown),such as a microphone, joy stick, game pad, satellite dish, scanner, orthe like. These and other input devices are often connected to theprocessing unit 121 through a serial port interface 46 coupled to systembus 123. Alternatively, the input devices may be connected by otherinterfaces, such as a parallel port, a game port or a universal serialbus (USB). A monitor 147 or another display device is also connected tosystem bus 123 via an interface, such as video adapter 148. In additionto the monitor, personal computers typically include other peripheraloutput devices (not shown), such as speakers and printers.

The computer 120 may operate in a networked environment using logicalconnections to one or more remote computers, such as remote computers149 a and 149 b. Remote computers 149 a and 149 b may each be anotherpersonal computer, a server, a router, a network PC, a peer device orother common network node, and typically include many or all of theelements described above relative to the computer 120, although onlymemory storage devices 150 a and 150 b and their associated applicationprograms 136 a and 136 b have been illustrated in FIG. 1. The logicalconnections depicted in FIG. 1 include a local area network (LAN) 151and a wide area network (WAN) 152 that are presented here by way ofexample and not limitation. Such networking environments are commonplacein office-wide or enterprise-wide computer networks, intranets and theInternet.

When used in a LAN networking environment, the computer 120 is connectedto the local network 151 through a network interface or adapter 153.When used in a WAN networking environment, the computer 120 may includea modem 154, a wireless link, or other means for establishingcommunications over the wide area network 152, such as the Internet. Themodem 154, which may be internal or external, is connected to the systembus 123 via the serial port interface 146. In a networked environment,program modules depicted relative to the computer 120, or portionsthereof, may be stored in the remote memory storage device. It will beappreciated that the network connections shown are exemplary and othermeans of establishing communications over wide area network 152 may beused.

FIG. 2 illustrates an architecture 200 that includes a service 210 and aclient 220 that are coupled together via network 240. The client 220 maybe, for example, the computer 120 described above with respect to FIG.1, although the client 220 may be implemented by any computing device orsystem. The service 210 comprises a computing entity or a number ofcomputing entities that cooperatively interact to maintainhierarchically-structured data 211. The client 220 includes anapplication 221 that potentially has interest in accessing the data 211.If the client 220 were computer 120, the application 221 may be, forexample, the operating system 135, one of application programs 136, orperhaps one of the other program modules 137. In that case, the client220 may have interest in incorporating at least part of the data 211 asits own program data 138.

One way for the client 220 to access the hierarchically-structured data211 is to request the data directly from the service 210 over thenetwork 240. This may be performed directly via the managed code module227. This is advantageous in that the returned data is fresh as of therequested time, but disadvantageous in that the properties of thenetwork 240 may cause a response to the request to be noticeably slowwith a relatively high latency. In order to avoid this potentially slowresponse, the client 220 has a sophisticated caching mechanism 222 asrepresented by the various modules to the left of the brackets 222.

When a request for particular data is dispatched by the application 221,the caching mechanism 222 determines whether the request may besatisfied by data already locally accessible by the client 220. If thelocal data is sufficiently fresh, then the request will be satisfiedlocally and not by sending the request over the network 240 to theservice 210. This caching is advantageous in that a response to therequest is much quicker than would be the response if the request hadbeen sent over the network 240.

The caching mechanism includes a cache logic module 223. When theapplication 221 would like particular data from the service 210, theapplication 221 submits a request for the data to the cache logic module223. The cache logic module 223 then determines, based on a policiesmodule 225, whether the request would be best satisfied by immediatelyacquiring a cached copy of the requested data from a local store 224, orwhether it was beneficial to obtain a copy of the requested data fromthe service 210 instead. If a copy from the service 210 is requested,the synchronization engine 226 may acquire the requested data from theservice 210. Alternatively, the policies module 225 may dictate that thesynchronization engine 226 should first synchronize all or a portion ofthe data 211 before the cache logic 223 acquires the data from the localstore 224.

In one embodiment, the service 210 provides the data 211 in anextensible markup language format. XML segments comprise ahierarchically-structured tree in which each node in the tree isrepresented by a name-value pair called a tag. Each tag may haveattributes that comprise further name value pairs that form the tag. XMLsegments are well known in the art and are widely used to represent datain a hierarchically-structured tree. The shape and characteristics ofthe XML tree may be defined by an XML Schema Description (XSD) languagedocument or a Web Services Description Language (WSDL) document. One ofthe beneficial properties of XSD and WSDL is that it allows fordifferent XML structures to accommodate varying underlying properties ofan item being described. In addition, XSD allows XML documents to beextended as the need for additional information regarding the item isrecognized as being useful. The use of such schemas allows forapplications to not only read the data, but to understand the data andthereby perform intelligent actions. For example, instead of justreading the data “1812”, the application may understand that the datarepresents a year. Accordingly, the application may provide options toretrieve further historical data regarding the year 1812.

Accordingly, the application 221 interfaces with thehierarchically-structured document either by accessing thehierarchically-structured data 211 from the service 210 via managed code227, or by accessing the synchronized form of the data from the localstore 224. When requests to operate on a particularhierarchically-structured document are submitted by the application 221to the cache logic module 223, there may be a managed code module 227that allows for the program to express the operations to be performedwithout referencing the structure of the hierarchically-structured XMLdocument.

In a network environment, there may several clients such as client 220in communication with several services such as service 210. For example,FIG. 3 illustrates a network environment 300 in which multiple clients320 interface with multiple services 310 over a network 330. The clients320 may be configured as described above for client 220. Although fiveclients 320A through 320E are illustrated, there may be other numbers ofclients interacting with services over the network 330. The network 330may be any network or combination of networks such as, for example, theInternet. If the network 330 was the Internet, for example, manythousands of such clients may exist.

The services 310 may each maintain hierarchically-structured documents(e.g., XML documents) of at least one particular class. For example,there might be one network service 310A that maintains XML documentsthat follow a particular pattern or schema for contact information,another network service 310B that maintains XML documents that follow aparticular schema for calendar information, another network service 310Cthat follows a particular schema for application setting information,and so forth.

There are several factors that may make it convenient for a programmerto not have to deal directly with the structure of ahierarchically-structured document in such an environment. For example,since there are many different types of things that may be described byan XML document, there may potentially be many standardized schemas thatmay be followed for a variety of different network services.Accordingly, when drafting a program that is to interface withhierarchically-structured documents, a programmer that directlyinterfaces with hierarchically-structured documents would need to haveknowledge of which particular schema the document follows, as well ashow the schema is organized.

Also, in many cases, there may be standard methods that are used whendealing with any XML document, no matter what schema the XML documentfollows. For example, regardless of whether the XML document follows acalendar schema, a wallet schema, a contacts schema, or an applicationsetting schema, certain methods such as insert, delete, query, replace,or update may be common for all of the schemas due to the generic natureof the methods. However, there may also be customized methods that aretailored to each of the schemas. It may require some study forprogrammers to keep track of what custom methods are offered for theparticular schema(s) that they are interfacing with. For example, eachof the network services 310 has standard methods 312. However, thecontacts network service 310A has custom methods 313A, the calendarnetwork service 310B has custom methods 313B, and the applicationsetting service 310C has custom methods 313C.

Furthermore, in order to reduce the variety of requests that the servicewould have to deal with, it may be that only portions of thehierarchically-structured document may be operated upon as an atomicentity. For example, when changing the area code of a telephone numberfor a given person in a contacts list, it may be necessary to submit areplacement telephone numbers XML segment for that contact that re-listsall of the relevant telephone numbers for the contact, but with thecorrect area code inserted for the telephone number that is to becorrected. Keeping track of what can, and cannot, be operated upon as anatomic entity may require time for studying the schema. Rather thaninvest such time, programmers may instead choose to replace the entireXML document, instead of just the particular atomic XML segment(s) ofrelevance, thereby resulting in a waste of processing and bandwidthresources.

In one example, the portions that may be operated upon as an atomicentity are defined by the schema as being blue or red nodes. Blue nodesmay have one set of operations performed thereon as an atomic entity,while red nodes may have another set of operations performed thereon.The schema may also define black nodes which may potentially be childnodes of a blue or red node. These black nodes may not be operated uponas an atomic entity. Instead, if a black node is desired to be operatedupon (e.g., changed, inserted, or queried), the operation is insteadperformed on a parent or ancestor blue or red node. While this datamodel reduces the complexity of the application that maintains thehierarchically-structured documents, the programmer would need to keeptrack of what nodes may be atomically operated upon in order to mostefficiently interface with the hierarchically-structured document.

Finally, the different atomic entities of the XML document that may beseparately operated upon may have their own change tracking information.It would also require invested time for programmers to track when achange tracking information is to be changed, to what, and how thechange tracking information is inherited throughout the various nodes ofthe hierarchically-structured document.

This is not to say that a programmer may not become well-familiar withhow to draft source code that interfaces directly with the structure ofthe hierarchically-structured document with some effort, but theprinciples of the present invention makes it easier for the programmerby no longer requiring that the programmer draft source code thatdirectly interfaces with the structure of the hierarchically-structureddocument.

FIG. 4 illustrates several logical flows that may be implemented by themanaged code module 227. FIG. 5 illustrates a method 500 for allowing aprogrammer to draft source code that causes interaction withhierarchically-structured documents by interfacing with an early-boundobject, rather than with the hierarchically-structured document itself.The logical flows of FIG. 4 will be described with frequent reference tothe method of FIG. 5.

The method 500 includes a functional result-oriented step for allowing afunction call for indirect manipulation of a hierarchically-structureddocument that includes change tracking information (step 510). Whilethis step may include any corresponding acts for accomplishing thisresult, the step is illustrated as including corresponding acts 511,512, 513 and 514. In particular, a description of the schema of ahierarchically-structured document of a particular class is accessed(act 511). Referring to FIG. 4, the description document 410 isaccessed. The description document 410 has properties 411A, 411B and411C and methods (either express or implied) that may be performed onhierarchically structured documents of the particular class. At leastone of the properties (e.g., property 411 C) includes change trackinginformation as represented by the box 411C having a thicker boundary.For example, if the hierarchically-structured document was an XMLdocument, the change tracking information may be an attribute of anyportion of the XML document that may be separately operated upon.

The description document may be, for example, an XSD or WSDL document aspreviously described. A WSDL document is an XML-formatted language thatdescribes methods exposed by a particular service, while an XSD documentdefines the structure of the data that is passed in and out of themethods described by the WSDL document.

The step 510 also includes an act of converting the description of theschema into at least one early-bound object that has data fields forstoring at least some of the properties as well as at least some of themethods that correspond to the hierarchically-structured documents ofthe particular class (act 512). Referring to FIG. 4, this act isindicated by the description document 410 being received by theearly-bound object generator 420. As mentioned above, the descriptiondocument 410 may be a combination of a WSDL document and an XSD documentfor a given service.

The early-bound object generator 420 then, in turn, generates theearly-bound object 430. In one embodiment, the description document isconverted into two types of objects specific to a given service. Namely,a connection object embodies the methods that can be invoked on theservice. In addition, a data object embodies the data types that arepassed in and out of those methods.

An early-bound object representation of an XML type is a representationin which the XML attributes and XML elements of the XML type aresurfaced as properties of the programmable object. In most programminglanguages, this then lends itself to a fairly intuitive programmingsyntax (e.g Contact.FirstName when referring to the first name of acontact). Early-bound objects are quite familiar to most programmers.Accordingly, software programmers are often more comfortable draftingsource code that interfaces with an early-bound object, than to ahierarchically structured XML document. There are conventional methodsavailable for performing the conversion of an XML document into acorresponding early-bound object. For example, .NET™ FRAMEWORK is aconventionally available product that may be used to converthierarchically-structured documents into early-bound objects.

The step 510 also includes an act of detecting a property modificationto the early-bound object (act 513). In FIG. 4, this is represented bythe source code 440 communicating with the early-object via functioncall 431. Then, the early-bound object corresponding to the modificationadjusts the property that includes changing tracking information (act514) in response to the detection of the property modification and inaccordance with change tracking rules. Accordingly, the programmer neednot himself keep track of change information. Instead, the early-boundobject adjusts and tracks the change information.

In addition to change tracking information, the generated connectionearly-bound object may include methods that abstract the process ofdiscovering an appropriate service from the view of the programmer. Forexample, the connection early-bound object may include a method thatcontacts a centralized service that is capable of finding an appropriatecalendar (or other) service for a given user. In addition, the methodsexposed by the connection object (and also the service) may have commonsecurity behaviors related to, for example, encryption, authentication,digital signatures and the like. These security behaviors may becumbersome and complex to program directly. They also may have commonheaders (e.g., SOAP headers when the methods are SOAP methods) which areroutine but tedious to program directly. Programmers can be relieved ofall of these tasks.

The corresponding XML document is then altered as appropriate for thefunction call (act 515). The early-bound object 430 may accomplish theappropriate alteration of the hierarchically-structured document by, forexample, making function calls 432 using a function library 450. Onetype of function library is a Dynamic Link Library (DLL) file forfunctions that are more common. Functions that are either directlyimplemented by the object or that are indirectly implemented via, forexample, a DLL file may keep track of the structure of thehierarchically-structured document, what portions of the document may beoperated upon as an atomic entity, how to maintain change trackinginformation, or other common operations. Accordingly, the programmerneed not be concerned about all of the details involved withmanipulating a hierarchically-structured document. This makes it easierfor the programmer to deal in an environment in which the program is tointerface with such hierarchically-structured documents since theprogrammer only has to draft source code to interface with the familiarform of an early-bound object.

Various classes that may be implemented by the managed code module 227will now be described. While specific class are described herein, one ofordinary skill in the art will recognize, after having reviewed thisdescription, that there are many software implementations that fallwithin the scope of the present invention. The example classes are onlyone possible implemented and are provided by way of illustration only,and not to limit the scope of the invention.

The IServiceConnection class is an interface implemented by all classesthat manage connections to a service such as service 210 in FIG. 2. Onesuch implementation is the SoapHttpServiceConnection class describedfurther below. The following is source code that describes theIServiceConnection class:

[Serializable] interface IServiceConnection { // Properties stringServiceName { get; } string DocumentName { get; } string Owner { get; }ConnectionState State { get; } // Methods void Open(); void Open(stringusername, string password); void Close(); }

The void Open( ) and void Open(string userName, string password) methodsmay be called to open a connection to the specified service. The firstvariant uses implicit credentials for access authorization, whereas thesecond provides explicit credentials. The void Close( ) method closesthe connection and frees any associated resources. Other classes alsomay include these open and close methods.

The string DocumentName {get;} property gets the name of the servicedocument to connect to. For example, referring to FIG. 3, each service310 may maintain a “content” document and a “role list” document foreach data owner for whom it maintains data. The content documentincludes the main information of interest (e.g., contact information fora contacts service), while the role list document contains accesscontrol information and permissions.

The string Owner {get;} property gets the name of the owner of theservice instance to connect to. Each document at a service may be ownedby a particular entity such that access to that document is controlledby that entity. The string ServiceName {get;} property gets the name ofthe service to connect to (e.g. “Contacts” or “Calendar”). TheConnectionState State {get;} property returns the current state of theconnection. Other classes may also include a similar DocumentName,Owner, ServiceName and State properties.

The SoapHttpConnection class is used to manage a connection to a serviceover Simple Object Access Protocol/HyperText Transport Protocol(SOAP/HTTP). The following source code describes the SoapHttpConnectionclass:

abstract class SoapHttpConnection:System.Web.Services.Protocols.SoapHttpClientProtocol, IServiceConnection{ // Constructor protected SoapHttpConnection (); protectedSoapHttpConnection (string serviceName); protected SoapHttpConnection(string serviceName, string documentName); protected SoapHttpConnection(string serviceName, string documentName, string owner); // Methodsprotected string GetMethodNameFromRequest (System.Xml.XmlNode node);protected void PrepareHeaders (string methodName); protected virtualvoid SaveHeaders (); protected virtual void RetrieveHeaders (stringmethodName); protected System.Xml.XmlElement XmlSerialize (object obj);protected object XmlDeserialize (System.Xml.XmlElement xmlHeader);protected override void Dispose (bool disposing); void Open(); voidOpen(string username, string password); void Close(); // // Propertiesstring ServiceName { get; } string DocumentName { get; } string Owner {get; } ConnectionState State { get; } }

The SoapHttpConnection (string serviceName, string documentName) andSoapHttpConnection (string serviceName, string documentName, stringowner) constructors initialize a new SoapHttpConnection instance. Thesupplied parameters provide specific initial values for the ServiceName,DocumentName and Owner properties. If the Owner property is notsupplied, then the value will be taken from theWindowsIdentity.GetCurrent( ) property. The user name property is takenfrom the name portion of the WindowsIdentity.GetCurrent( ) property. Ifthe connection state of the object is Open or Opening, then no furtheraction is taken.

ServiceAdapter is a class of the managed code module 227 that definesthe methods by which data objects are filled with XML data from theservice and have their changes committed against the service. Thefollowing source code defines this class:

class ServiceAdapter { // Constructor ServiceAdapter(IServiceConnectionserviceConnection); // Properties IServiceConnection ServiceConnection {get; } // Methods void Update(IServiceData serviceData); voidFill(IServiceData serviceData); void Fill(IServiceData serviceData,string xpath, System.Xml.Serialization.XmlSerializerNamespacesnamespaces); }

The ServiceAdapter (IServiceConnection serviceConnection) constructorinitializes a new ServiceAdapter. The supplied parameter provides theconnection object that is used to communicate with the service.

The void Update(IServiceData serviceData) method commits changes in thepassed-in data objects to the underlying service. The data is specifiedas a single IServiceData object. If the operation is successful, thenIServiceData.AcceptChanges will be automatically called on the servicedata object supplied to the call.

The void Fill(IServiceData serviceData) and the void Fill(IServiceDataserviceData, string xpath,System.Xml.Serialization.XmlSerializerNamespaces namespaces) methodspopulate the passed-in IServiceData object from the underlying service.Typically the XPath that is used as the basis for the underlying querywill be constructed automatically from the supplied data target, inwhich case the first form of the method is used. However the caller cansupply explicit XPath expressions to override this using the second formof the method. Most typically the second form above is used to filterthe items returned into a ServiceObjectCollection subclass instance or aServiceAnyObjectCollection instance. If the operation is successful thenIServiceData.AcceptChanges will be called on the object supplied to thecall. The IServiceConnection ServiceConnection {get;} property definesthe proxy used by this ServiceAdapter to communicate with the service.

As previously mentioned, the principles of the present invention make iteasier for some programmers by allowing them to interface withearly-bound objects, rather than with the underlyinghierarchically-structured document. The primary purpose of the majorityof these early-bound classes is to provide a basis by which early-bound(strongly typed) data classes for a specific service can be“self-auditing”; i.e. the objects themselves know how they have beenmodified by the client, and use this information as the basis forcorrectly updating the service that maintain the correspondinghierarchically-structured documents when the changes are committed.

The IServiceData interface is implemented by all early-bound dataobjects as is structured as follows:

interface IServiceData { // Properties IServiceData Parent { get; }ChangeState State { get; } bool  HasChanges { get; } // Methods voidAcceptChanges (); void SetParent(IServiceData parent, stringpropertyNameInParent); }

Calling the void AcceptChanges( ) method marks the change state of theobject as ChangeState.Unchanged. It also informs the parent object thatthis object should be regarded as unchanged. This method is calledinternally by ServiceAdapter.Update and ServiceAdapter.Fill in theresult of a successful operation.

The void SetParent(IServiceData parent, string propertyNameInParent)method assigns the specified parent to this object and sets the name ofthe property that represents this object in the parent.

The IServiceData Parent {get;} property returns the parent of thisobject, or null if the object has no parent. The ChangeState State{get;} property returns the current change state of this object. Thebool HasChanges {get;} property returns an indication of whether theobject has been changed since the last time it was populated from theservice or AcceptChanges was called.

The ServiceObject class is the basis for all automatically generateddata objects that correspond to single values for which the type isknown at generation time and is structured as follows:

[Serializable] abstract class ServiceObject:IServiceObject { //Constructors protected ServiceObject (); protected ServiceObject(IServiceData parent, string propertyNameInParent); // Methods voidDelete (); protected virtual void OnPropertyChanging(PropertyChangingEventArgs e); protected virtual void OnPropertyChanged(System.ComponentModel.PropertyChangedEventArgs e); protected voidSetAnyProperty(ref ServiceAnyObject currentValue, ServiceAnyObject newValue, string propertyName); protected void SetStringProperty(ref stringcurrentValue, string newValue, string propertyName); protected voidSetBoolProperty(ref bool currentValue, bool newValue, stringpropertyName); protected void SetShortProperty(ref short currentValue,short newValue,string propertyName); protected void SetIntProperty(refint currentValue, int newValue, string propertyName); protected voidSetLongProperty(ref long currentValue, long newValue, stringpropertyName); protected void SetEnumProperty(ref int currentValue, intnewValue, System.Type enumType, string propertyName); protected voidSetDateTimeProperty(ref System.DateTime currentValue, System.DateTimenewValue, string propertyName); protected void SetByteArrayProperty(refByte[] currentValue, Byte[] newValue, string propertyName); protectedvoid SetSpecifierProperty(ref bool currentValue, bool newValue, stringspecifiedPropertyName); void RaisePropertyChanged (string propertyName,object old Value, object newValue); void RaisePropertyChanging (stringpropertyName, object newValue); void IServiceData.AcceptChanges (); voidIServiceData.SetParent (IServiceData parent, stringpropertyNameInParent); // Properties IServiceData IServiceData.Parent {get; } ChangeState IServiceData.State { get; }bool  IServiceData.HasChanges { get; } // events eventPropertyChangingEventHandler PropertyChanging; eventSystem.ComponentModel.PropertyChangedEventHandler PropertyChanged; }

The ServiceObject ( ) and ServiceObject (IServiceData parent, stringpropertyNameInParent) constructors initialize a new ServiceObject withappropriate values for the IServiceData.Parent property (or null if notspecified).

The void Delete( ) method marks the object as to be deleted when it (oran ancestor) is next passed to ServiceAdapter.Update. On successfulupdate the object will be removed from the parent collection (if itbelongs to a collection).

The protected virtual void OnPropertyChanging(PropertyChangingEventArgse) method is used to raise the PropertyChanging event. The protectedvirtual voidOnPropertyChanged(System.ComponentModel.PropertyChangedEventArgs e)method is used to raise the PropertyChanged event.

The protected void SetAnyProperty (ref ServiceAnyObject currentValue,ServiceAnyObject newValue, string propertyName) method sets the value ofan XML-valued property in a subclass of this class. It is only intendedto be called by subclass property set accessors, and acts as a helperfunction to ensure that the correct events are raised in the process ofsetting the property. The protected void SetStringProperty (ref stringcurrentValue, string newValue, string propertyName) method sets thevalue of a string property in a subclass of this class. The protectedvoid SetBoolProperty (ref bool currentValue, bool newValue, stringpropertyName) method sets the value of a boolean property in a subclassof this class. The protected void SetShortProperty (ref shortcurrentValue, short newValue, string propertyName) method sets the valueof a short property in a subclass of this class. The protected voidSetIntProperty (ref int currentValue, int newValue, string propertyName)method sets the value of an int property in a subclass of this class.The protected void SetLongProperty (ref long currentValue, longnewValue, string propertyName) method sets the value of a long propertyin a subclass of this class. The protected void SetEnumProperty (ref intcurrentValue, int newValue, System.Type enumType, string propertyName)method sets the value of an enumerated value property in a subclass ofthis class. The protected void SetStringProperty (ref System.DateTimecurrentValue, System.DateTime newValue, string propertyName) method setsthe value of a datetime property in a subclass of this class. Theprotected void SetByteArrayProperty (ref byte[ ] currentValue, byte[ ]newValue, string propertyName) method sets the value of a byte arrayproperty in a subclass of this class. The protected voidSetSpecifierProperty (ref bool currentValue, bool newValue, stringspecifiedPropertyName) method sets the value of a specifier property(i.e. a property that acts as a presence flag for another property,where the type of the latter cannot encompass a null value such as int)in a subclass of this class. The methods described in this paragraph areonly intended to be called by subclass property set accessors, and actsas a helper function to ensure that the correct events are raised andactions performed in the process of setting the property.

The void RaisePropertyChanged (string propertyName, object oldValue,object newValue) method is called by generated subclasses to handleprocessing of property changes. The void RaisePropertyChanging (stringpropertyName, object newValue) method is called by generated subclassesto handle processing of proposed property changes. The voidIServiceData.AcceptChanges( ) method marks the change state of theobject as ChangeState.Unchanged. It also informs the parent object thatthis object should be regarded as unchanged. This method is calledinternally by ServiceAdapter.Update and ServiceAdapter.Fill in theresult of a successful operation. The voidIServiceData.SetParent(IServiceData parent, string propertyNameInParent)method assigns the specified parent to this object and sets the name ofthe property that represents this object in the parent.

The IServiceData IServiceData.Parent {get;} property returns the parentof this object, or null if the object has no parent. The ChangeStateIServiceData.State {get;} property returns the current change state ofthis object. The bool IServiceData.HasChanges {get;} property returns anindication of whether the object has been changed since the last time itwas populated from the service or AcceptChanges was called.

The ServiceObjectCollection class is the basis for all automaticallygenerated data objects that correspond to value collections and isstructured as follows:

[Serializable] abstract classServiceObjectCollection:IServiceObjectCollection { // Constructorsprotected ServiceObjectCollection (); protected ServiceObject(IServiceData parent, string propertyNameInParent); // Methods protectedvirtual void OnListChanged (System.ComponentModel.ListChangedEventArgse); void IServiceData.AcceptChanges (); void IServiceData.SetParent(IServiceData parent, string propertyNameInParent);void  IBindingList.AddIndex(System.Reflection.PropertyDescriptorproperty); void IBindingList.AddNew (); void IBindingList.ApplySort(System.Reflection.PropertyDescriptor property,System.ComponentModel.ListSortDirection direction); intIBindingList.Find (System.Reflection.PropertyDescriptor property, objectkey); void IBindingList.RemoveIndex(System.Reflection.PropertyDescriptor property); voidIBindingList.RemoveSort (); void ICollection.CopyTo (System.Array array,int index); System.Collections.IEnumerator IEnumerator.GetEnumerator ();int IList.Add (object item); void IList.Clear (); bool IList.Contains(object item); int IList.IndexOf (object item); void IList.Insert (intindex, object item); void IList.Remove (object item); voidIList.RemoveAt (int index); // Properties int Count { get; }IServiceData IServiceData.Parent { get; } ChangeState IServiceData.State{ get; } bool IServiceData.HasChanges { get; } boolIBindingList.AllowEdit { get; } bool IBindingList.AllowNew { get; } boolIBindingList.AllowRemove { get; } bool IBindingList.IsSorted { get; }System.ComponentModel.ListSortDirection IBindingList.SortDirection {get; } System.Reflection.PropertyDescriptor IBindingList.SortProperty {get; } bool IBindingList.SupportsChangeNotification { get; } boolIBindingList.SupportsSearching { get; } boolIBindingList.SupportsSorting { get; } bool ICollection.IsSynchronized {get; } object ICollection.SyncRoot { get; } bool IList.IsFixedSize {get; } bool IList.IsReadOnly { get; } object IList.this[int i] { get;set; } // Events event System.ComponentModel.ListChangedEventHandlerListChanged; }

The protected ServiceObjectCollection (IServiceData parent, stringpropertyNameInParent) constructor initializes a new emptyServiceObjectCollection object with appropriate values for theIServiceData.Parent property.

The protected virtual voidOnListChanged(System.ComponentModel.ListChangedEventArgs e) method isused to raise the ListChanged event.

The void IServiceData.AcceptChanges( ) method marks the change state ofthe object as ChangeState.Unchanged. It also informs the parent objectthat this object should be regarded as unchanged.

The void IServiceData.SetParent(IServiceData parent, stringpropertyNameInParent) method assigns the specified parent to this objectand sets the name of the property that represents this object in theparent.

The object IBindingList.AddNew( ) method adds a new object to thecollection and returns a reference to that object. The actual type ofthe object is determined by the subclass.

The void ICollection.CopyTo(SystemArray array, int index) method copiesthe elements of the collection to an array, starting at the specifiedindex within the array.

The System.Collections.IEnumerator IEnumerable.GetEnumerator( ) methodreturns an enumerator that can iterate through the collection.

The int IList.Add(object item) method adds a new item to the list.

The void IList.Clear( ) method removes all items from the list.

The bool IList.Contains(object item) method returns true if and only ifthe specified item is in the list.

The int IList.IndexOf(object item) method returns the position of theitem to the list.

The void IList.Insert(int index, object item) method adds a new item tothe list at the specified position.

The void IList.Remove(object item) method removes the first occurrenceof the item from the list.

The void IList.RemoveAt(int index) method removes the item from thespecified position in the list.

The IServiceData IServiceData.Parent {get;} property returns the parentof this object, or null if the object has no parent.

The ChangeState IServiceData.State {get;} property returns the currentchange state of this object.

The bool IServiceData.HasChanges {get;} property returns an indicationof whether the object has been changed since the last time it waspopulated from the service or AcceptChanges was called.

The bool IBindingList.AllowEdit {get;} property returns an indication ofwhether list members can be modified. It always returns true for thisimplementation.

The bool IBindingList.AllowNew {get;} property returns an indication ofwhether new items can be added to the list. It always returns true forthis implementation.

The bool IBindingList.AllowRemove {get;} property returns an indicationof whether members can be removed from the list. It always returns truefor this implementation.

The bool IBindingList.IsSupported {get;} method returns an indication ofwhether the members of the list have been sorted.

The System.ComponentModel.ListSortDirection IBindingList.SortDirection{get;} property returns an indication of the direction in which themembers of the list have been sorted.

The System.Reflection.PropertyDescriptor IBindingList.SortProperty{get;} property returns the property that has been selected as the basisfor sorting the members of the list.

The bool IBindingList.SupportsChangeNotification {get;} property returnsan indication of whether the list will raise ListChanged events.

The bool IBindingList.SupportsSearching {get;} property returns anindication of whether the list supports searching.

The bool IBindingList.SupportsSorting {get;} property returns anindication of whether the list supports sorting. It always returns falsefor this implementation.

The bool ICollection.IsSynchronized {get;} property returns anindication of whether access to this list is thread-safe.

The object ICollection.SyncRoot {get;} property returns an object thatcan be used to synchronize access to this list.

The object IList.this[int i] {get; set;} property provides aposition-based indexer into the collection.

The bool IList.IsFixedSize {get;} property returns an indication ofwhether the list has a fixed size.

The bool IList.IsReadOnly {get;} property returns an indication ofwhether the list is immutable.

The System.ComponentModel.ListChangedEventHandlerListChanged event israised immediately after the contents of the list are changed.

The PropertyChangingEventHandler PropertyChanging event is raisedimmediately prior to a property value being changed. TheSystem.ComponentModel.PropertyChangedEventHandlerPropertyChanged eventis raised immediately after a property value is changed.

This section defines all the attribute classes. These attributes areused to decorate generated data classes from schemas, and capture datamodel characteristics. The generator decorates certain properties orclasses with these attributes automatically.

When applied to a property, the SpecifierAttribute attribute declaresthat the property acts as a specifier for another property whose typecannot encompass the notion of “no value assigned”. The attribute isdefined as follows:

[AttributeUsage(AttributeTargets.Property, Inherited=true,Multiple=false] sealed class SpecifierAttribute:System.Attribute { /Constructors SpecifierAttribute (string propertySpecified); //Properties string PropertySpecified { get; } }

The SpecifierAttribute (string propertySpecified) method initializes anew instance of the SpecifierAttribute class with the given value forthe PropertySpecified property. The string PropertySpecified {get;}property returns the name of the property for which the attributedproperty acts as a specifier.

The ServiceObjectAttribute attribute is used to specify the meta-datafor a data object. This attribute may be applied to a class or aproperty. This is an abstract class and is not instantiated directly.The attribute is structured as follows:

[AttributeUsage(AttributeTargets.Class|AttributeTargets.Property,Inherited=true, Multiple=false] abstract classServiceObjectAttribute:System.Attribute { // Constructors protectedServiceObjectAttribute (); // Properties bool IsReadOnly { get; set; }bool IsUniqueForCollection { get; set; } bool IsUniqueForAllCollections{ get; set; } bool IsGloballyUnique { get; set; } boolIsAtomicallyUpdateable { get; set; } bool IsQueryable { get; set; } boolIsChangeQueryable { get; set; } bool IsRequired { get; set; } stringIdentifierProperty { get; set; } }

The ServiceObjectAttribute ( ) method initializes a new instance of theServiceObjectAttribute class all properties set to false. The boolIsReadOnly {get; set;} property determines whether the attributed classor property represents a writable object in accordance with the schemasfor the hierarchically-structured document to be operated upon. The boolIsUniqueForCollection {get; set;} property determines whether theattributed class or property represents a value that acts as a key forits parent in the nearest ancestor collection in the schemas (e.g. isthis a key for a contact in any given folder). The boolIsUniqueForAllCollections {get; set;} property determines whether theattributed class or property represents a value that acts as a key forits parent in all instances of the nearest ancestor collection. The boolIsGloballyUnique {get; set;} property determines whether the attributedclass or property represents a value that acts as a globally unique key(e.g. a GUID).

The bool IsAtomicallyUpdateable {get; set;} property determines whetherthe attributed class or property can be individually updated or whetherupdates (add/delete/replace) must be performed on some suitable ancestornode. The bool IsQueryable {get; set;} property determines whether theattributed class or property can be individually queried. The boolIsChangeQueryable {get; set;} property determines whether the attributedclass or property can be individually change tracked for synchronizationpurposes.

The string IdentifierProperty {get; set;} property gets or sets a stringvalue that contains the name of the identifier property for theattributed class. If this value is String.Empty, then it is assumed thatthe class has no identifier property. The bool IsRequired {get; set;}property determines whether the attributed class or property must have asupplied value to be schema-valid.

The RootObjectAttribute attribute specifies the meta data for a dataobject that acts as the root of the data hierarchy. This attribute maybe applied to a class or a property and has the following structure:

[AttributeUsage(AttributeTargets.Class|AttributeTargets.Property, =true,Multiple=false] sealed class RootObjectAttribute:ServiceObjectAttribute{ // Constructors public RootObjectAttribute (); }

The RootObjectAttribute ( ) constructor initializes a new instance ofthe RootObjectAttribute class with the following properties set to true(all others being false): 1)ServiceObjectAttribute.IsAtomicallyUpdateable, 2)ServiceObjectAttribute.IsQueryable, and 3)ServiceObjectAttribute.IsChangeQueryable.

The BlueObjectAttribute specifies the meta data for a blue data object.A blue data object in a particular data model may define a particulardata segment of the hierarchically-structured document that may beoperated on as an atomic entity. This attribute may be applied to aclass or a property. The attribute may be structured as follows:

[AttributeUsage(AttributeTargets.Class|AttributeTargets.Property,Inherited=true, Multiple=false] sealed classBlueObjectAttribute:ServiceObjectAttribute { // Constructors publicBlueObjectAttribute (); }

The BlueObjectAttribute ( ) attribute initializes a new instance of theBlueObjectAttribute class with the following properties set to true (allothers being false): 1) ServiceObjectAttribute.IsAtomicallyUpdateable,2) ServiceObjectAttribute.IsQueryable, 3)ServiceObjectAttribute.IsChangeQueryable, and 4)ServiceObjectAttribute.IsIdentifiable.

The RedObjectAttribute attribute specifies the meta data for a redservice object. A red service object may represent yet anotherportion(s) of the hierarchically-structured document that may beoperated upon as an atomic entity. This attribute may be structured asfollows:

[AttributeUsage(AttributeTargets.Class|AttributeTargets.Property,Inherited=true, Multiple=false] sealed classRedObjectAttribute:ServiceObjectAttribute { // Constructors publicRedObjectAttribute (); }

RedObjectAttribute ( ) constructor initializes a new instance of theRedObjectAttribute class with the following properties set to true (allothers being false): 1) ServiceObjectAttribute.IsAtomicallyUpdateable,and 2) ServiceObjectAttribute.IsQueryable.

The BlackObjectAttribute attribute specifies the meta data for a blackdata object. This attribute may be applied to a class or a property. Ina particular data model, black objects may be used to represent aportion of the hierarchically-structured document that may not beoperated upon as an atomic entity. The attribute may be structured asfollows:

[AttributeUsage(AttributeTargets.Class|AttributeTargets.Property,Inherited=true, Multiple=false] sealed classBlackObjectAttribute:ServiceObjectAttribute { // Constructors publicBlackObjectAttribute (); }

BlackObjectAttribute ( ) constructor initializes a new instance of theBlackObjectAttribute class with all properties set to false.

A ServiceObjectCollectionAttribute attribute specifies the meta data fora service object collection. This attribute may be applied to a class ora property. This class is abstract and cannot be created directly. Theattribute may be structure as follows:

[AttributeUsage(AttributeTargets.Class|AttributeTargets.Property,Inherited=true, Multiple=false] abstract classServiceObjectCollectionAttribute:System.Attribute { // Constructorsprotected ServiceObjectCollectionAttribute (System.Type memberType); //Properties System.Type MemberType { get; }bool  IsMemberAtomicallyUpdateable { get; set; } }

The ServiceObjectCollectionAttribute (System.Type memberType)constructor initializes a new instance of theServiceObjectCollectionAttribute class with the specified value for theMemberType property and with the property IsMemberAtomicallyUpdateableset to false.

The System.Type MemberType {get;}property returns the type of themembers of the attributed collection. The boolIsMemberAtomicallyUpdateable {get;} property returns whether the membersof this collection can be individually updated against the service.

The BlueObjectCollectionAttribute specifies the meta data for acollection of blue data objects and may have the following structure:

[AttributeUsage(AttributeTargets.Class|AttributeTargets.Property,Inherited=true, Multiple=false] sealed classBlueObjectCollectionAttribute:ServiceObjectCollection- Attribute { //Constructors public BlueObjectCollectionAttribute (System.TypememberType); }

The BlueObjectCollectionAttribute (System.Type memberType) constructorinitializes a new instance of the BlueObjectCollectionAttribute classwith the specified value for ServiceObjectCollectionAttribute.MemberTypeand the value of theServiceObjectCollectionAttribute.IsMemberAtomciallyUpdateable propertyset to true.

The BlueAnyobjectCollectionAttribute specifies the meta data for acollection of blue data objects representing vendor extensions. Thisattribute may have the following structure:

[AttributeUsage(AttributeTargets.Class|AttributeTargets.Property,Inherited=true, Multiple=false] sealed classBlueAnyObjectCollectionAttribute:ServiceObjectCollection- Attribute { //Constructors public BlueAnyObjectCollectionAttribute (); }

The BlueAnyObjectCollectionAttribute ( ) constructor initializes a newinstance of the BlueAnyObjectCollectionAttribute class with a value oftypeof(ServiceAnyObject) for ServiceObjectCollectionAttribute.MemberTypeand the value of theServiceObjectCollectionAttribute.IsMemberAtomciallyUpdateable propertyset to true.

The RedObjectCollectionAttribute specifies the meta data for acollection of red data objects. This attribute may have the followingstructure:

[AttributeUsage(AttributeTargets.Class|AttributeTargets.Property,Inherited=true, Multiple=false] sealed classRedObjectCollectionAttribute : ServiceObjectCollectionAttribute { //Constructors public RedObjectCollectionAttribute (System.TypememberType); }

The RedObjectCollectionAttribute (System.Type memberType) constructorinitializes a new instance of the RedObjectCollectionAttribute classwith the specified value for ServiceObjectCollectionAttribute.MemberTypeand the value of theServiceObjectCollectionAttribute.IsMemberAtomciallyUpdateable propertyset to true.

The RedAnyCollectionAttribute specifies the meta data for a collectionof red data objects representing vendor extensions. This attribute mayhave the following structure:

[AttributeUsage(AttributeTargets.Class|AttributeTargets.property,Inherited=true, Multiple=false] sealed classRedAnyObjectCollectionAttribute : ServiceObjectCollectionAttribute { //Constructors public RedAnyObjectCollectionAttribute ( ); }

The RedAnyObjectCollectionAttribute ( ) constructor initializes a newinstance of the RedAnyObjectCollectionAttribute class with a value oftypeof(ServiceAnyObject) for ServiceObjectCollectionAttribute.MemberTypeand the value of theServiceObjectCollectionAttribute.IsMemberAtomciallyUpdateable propertyset to true.

The BlackObjectCollectionAttribute specifies the meta data for acollection of black data objects. This attribute may have the followingstructure:

[AttributeUsage(AttributeTargets.Class|AttributeTargets.Property,Inherited=true, Multiple=false] sealed classBlackObjectCollectionAttribute : ServiceObjectCollectionAttribute { //Constructors public BlackObjectCollectionAttribute (System.TypememberType); }

When a caller instantiates an early-bound data class, no data isretrieved from the underlying service. Instead, the caller explicitlyspecifies what subset of the data they wish to be retrieved. There maybe cases (for example, if the caller wishes only to add a new contact tomyContacts) where the caller does not need to retrieve any data.

Each early-bound red or blue object (or a collection thereof) supportsthe ServiceAdapter.Fill mechanism to control how and when the object ispopulated. The generated class includes metadata (as code attribution)from the underlying schemas that help the adapter determine how aninstance of the class can be identified for the purposes of querying.

The generated early-bound classes use data encapsulation, which isdefined to mean the abstraction of content data away from its underlyingXML Serialization into more intuitive code objects. The process by whichcode objects are generated from their XML schema definitions is bestillustrated by a simple example. We will use a simplified version of aMyServices Profile service schema for this purpose. The schema isdefined as follows:

<xsd:schema xmlns:xsd=“http://www.w3.org/2001/XMLSchema”xmlns:xdb=“urn:schemas-microsoft-com:xdb”xmlns:hs=“http://schemas.microsoft.com/hs/2002/04/core”xmlns:mc=“http://schemas.microsoft.com/hs/2002/04/myCalendar”targetNamespace=“http://schemas.microsoft.com/hs/2002/04/myProfile”xmlns=“http://schemas.microsoft.com/hs/2002/04/myProfile”elementFormDefault=“qualified” version=“1.0”> <xsd:annotation><xsd:appinfo> <xdb:blue select=“/myProfile”/> <xdb:blueselect=“/myProfile/*”/> <xdb:red select=“//@id”/> <xdb:redselect=“//myProfile/name/$any” /> <xsd:appinfo> </xsd:annotation><xsd:import namespace=http://schemas.microsoft.com/hs/2002/04/core”schemaLocation=“hscommon.xsd”/> <xsd:element name=“myProfile”type=“myProfileType”/> <xsd:complexType name=“myProfileType”><xsd:sequence> <xsd:element name=“name” type=“nameType”maxOccurs=“unbounded”/> <xsd:any processContents=“skip”namespace=“##other”/> <xsd:sequence> </xsd:complexType> <xsd:complexTypename=“nameType”> <xsd:sequence> <xsd:element name=“givenName”type=“xsd:string” minOccurs=“0”/> <xsd:element name=“lastName”type=“xsd:string” minOccurs=“0”/> <xsd:any processContents=“skip”namespace=“##other”/> </xsd:sequence> <xsd:attribute name=“id”type=“hs:idType” use=“required”/> </xsd:complexType> </xsd:schema>

In summary, the schema defines an XML element called myProfile, whichcan contain an unbounded collection of name elements, each of which iscomprised of two optional subelements to describe the given name andlast name followed by arbitrary XML content. Each name element isid-attributed. The myProfile element may also contain arbitrary XMLcontent.

The generator, when run against this schema, produces the followingclass to represent the content document of myProfile.

Generated Service-specific Assembly [XmlRoot(“myProfile”,Namespace=“http://schemas.microsoft.com/hs/2002/04/myProfile”,IsNullable=“false”)] [RootObject] public class myProfileType :ServiceObject { [XmlElement(“name”)][BlueObjectCollection(typeof(nameType)] public nameTypeCollection name {get; } [XmlAnyElementAttribute] [BlueAnyObjectCollection] publicServiceAnyObjectCollection any { get; } } [XmlType(Namespace=“http://schemas.microsoft.com/hs/2002/04/myProfile”)][BlueObjectCollection (typeof(nameType))] class nameTypeCollection :ServiceObjectCollection { public void Add (nameType m); public voidRemove (nameType m); public new nameType this[int i] { get; set; }public nameType AddNew ( ); } [XmlRoot(“name”, Namespace=“http://schemas.microsoft.com/hs/2001/10/myProfile”)][XmlType(Namespace=“http://schemas.microsoft.com/hs/2001/10/myProfile”)][BlueObject(PropertyIdentifier=“id”)] public class nameType :ServiceObject { [XmlAttribute(DataType=“nonNegativeInteger”)][RedObject(IsGloballyUnique=true)] public string id { get; set; }[RedObject] public string givenName; [RedObject] public string lastName;[XmlAnyElementAttribute] [BlueAnyObjectCollection] publicServiceAnyObjectCollection any { get; } }

Note that a class myProfileType has been generated to represent the XMLtype myProfileType. This class is derived from the ServiceObject class,and is attributed with RootObjectAttribute to declare that it forms theroot of the service document. For each child subelement of myProfile,the class declares a public property to represent that subelement. Thepurpose of exposing the child elements as properties is twofold; itleads to a more natural programming style (unlike methods) and it allowsinternal code (such as auditing or validation) to be executed when theproperty is modified (unlike fields).

The class nameTypeCollection models the collection of name elements. Itis derived from ServiceObjectCollection. It exposes strongly typedmethods to add and remove items from the collection, as well as adefault indexer. It is attributed with BlueObjectCollectionAttribute toindicate that it is composed of blue objects and to indicate the type ofthe contained element.

Each member of the collection is represented using the nameType class,which has simple member properties that encapsulate the subelements andattributes of the name element. The nameType class derives from from theServiceObject class. The nameType class is also attributed withBlueObjectAttribute to indicate that it is a blue object.

Each generated class carries its own XML serialization information toallow it to be serialized to XML and deserialized from XML.

The nameType and myProfileType classes also have child properties calledany of type ServiceAnyObjectCollection; this represents the vendorextension data expressed in raw XML form. Note that it is possible tomodify these classes to carry strongly bound properties for “known”vendor extensions.

To illustrate how the principles of the present invention simplify thesource code, consider the following example, in which VB.NET source codeis used to directly commit data changes to the hierarchical structure ofthe desired document by directly referencing that structure. Linenumbers are added for clarity.

1. If cardChanged Then 2. Dim replaceRequest As New replaceRequestType() 3. replaceRequest.select =“/m:myWallet/m:wallet[@id= ‘“& cardID &”‘]”4. ReDim replaceRequest.ItemsElementName(0) 5.replaceRequest.ItemsElementName(0) = myWallet.ItemsChoiceType1.card 6.ReDim replaceRequest.Items(0) 7. replaceRequest.Items(0) = card 8. DimreplaceResponse = myWallet.replace(replaceRequest) 9. Else IftypeOfCardChanged Or networkBrandChanged Then 10. DimneedToPerformUpdate as Boolean =_(—) typeOfCardChanged AndnetworkBrandChanged 11. Dim replaceRequest1 as replaceRequestType 12.Dim replaceRequest2 as replaceRequestType 13. If TypeOfCardChanged Then14. replaceRequest1 = New replaceRequestType() 15. IfneedToPerformUpdate Then 16. replaceRequest1.select = “.” 17. Else 18.replaceRequest1.select = “/m:myWallet” 19. End If 20.replaceRequest1.select &=”/m:wallet[@id= ‘“_(—)cardId & ”’]/m:typeOfCard21. ReDim ReplaceRequest1.ItemsElementName(0) 22.replaceRequest1.ItemsElementName(0) = _(—) ItemsChoiceType1.typeOfCard23. ReDim replaceRequest1.Items(0) 24. replaceRequest1.Items(0) =card.typeOfCard 25. EndIf 26. If networkBrandChanged Then 27.replaceRequest2 = New replaceRequestType( ) 28. If needToPerformUpdateThen 29. replaceRequest2.select=“.” 30. Else 31. replaceRequest2.select= “/m:myWallet” 32. End If 33. replaceRequest2.select +=“/m:wallet[@id=‘“&_(—) cardId & ”’]/m:networkBrand 34. ReDimreplaceRequest2.ItemsElementName(0) 35.replaceRequest2.ItemsElementName(0)=_(—)myWallet.ItemsChoiceType1.networkBrand 36. ReDimreplaceRequest2.Items(0)=card.networkBrand 37. EndIf 38. IfNeedToPerformUpdate Then 39. Dim updateRequest as New updateRequestType() 40. ReDim updateRequest.updateBlock(0) 41. Dim updateBlock as NewUpdateBlockType( ) 42. Redim updateBlock.replaceRequest(1) 43.updateBlock.replaceRequest(0) = replaceRequest1 44.updateBlock.replaceRequest(1) = replaceRequest2 45. updateBlock.select =“/” 46. updateBlock.onError = rollbackBlockAndFail 47. DimupdateResponse = myWallet.update(updateRequest) 48. Else If Not(replaceRequest1 is nothing) Then 49. Dim replaceRequest =myWallet.replace(replaceRequest1) 50. Else If Not (replaceRequest2 isnothing) Then 51. Dim replaceResponse =myWallet.replace(replaceRequest2) 52. End If 53. End If

Key characteristics of this code are that the caller uses its own changetracking information to determine what kind of SOAP message to build.Also, the caller manually builds the request structures. The caller alsohas to construct XPATH expressions to identify the replaced items. Thecaller also has set tags in order to correctly drive the serializationprocess. Now let us refer to a functionally identical piece of sourcecode that uses the managed code module 227 in accordance with theprinciples of the present invention. That managed code is illustrated asfollows:

1. ServiceAdapter.Update(Card)

Note that the managed code was reduced from over 50 lines of code tojust one line of code. This simplification reduces the complexity anddifficulty associated with drafting code that interfaces withhierarchically-structured documents.

The present invention may be embodied in other specific forms withoutdeparting from its spirit or essential characteristics. The describedembodiments are to be considered in all respects only as illustrativeand not restrictive. The scope of the invention is, therefore, indicatedby the appended claims rather than by the foregoing description. Allchanges which come within the meaning and range of equivalency of theclaims are to be embraced within their scope.

1. In a computer system that has access to a service that maintainshierarchically-structured documents of at least one particular class, amethod for facilitating the programming of source code wherein theprogrammer is relieved of having to track the document-specific schemaof the hierarchically-structured documents that may be called andoperated upon by the computer system when running the compiled sourcecode by permitting the computer system's processor to issue a functioncall that will interface with an early-bound object, thereby permittingthe early-bound object to adjust change tracking information that willresult in altering one of the hierarchically-structured documents of aparticular class rather than having to access the specific schema of thehierarchical document itself to do so, the method comprising thefollowing the following acts: accessing a description of the schema ofone or more hierarchically-structured documents of a particular class,the particular class of hierarchically-structured documents havingproperties and methods that may be performed on thehierarchically-structured documents of the particular class, wherein atleast one of the properties includes change tracking information;converting the accessed description of the schema into at least onecorresponding early-bound object that has data fields for storing atleast some of the properties as well as at least some of the methodsthat correspond to the hierarchically-structured documents of theparticular class, wherein the early-bound object comprises the changetracking information; detecting a property modification by receiving arequest to interface with the early-bound object in order to modify atleast one property of the at least one early-bound object as a result ofa function call from the microprocessor running the compiled program,the function call interfacing with the at least one early-bound objectrather than with the particular document description of the schema forthe one or more hierarchical documents of the particular class; an actof causing the at least one early-bound object that received themodification request to adjust the change tracking information of the atleast one early-bound object in response to the requested modification;and causing the at least one early-bound object to then either directlyor indirectly automatically manipulate a correspondinghierarchically-structured document of the particular class to reflectthe property modification.
 2. A method in accordance with claim 1,wherein the corresponding hierarchically-structured document of theparticular class comprises an eXtenstible Markup Language (XML)document.
 3. A method in accordance with claim 1, wherein thedescription of the schema of hierarchically-structured documents of aparticular class includes an identification of atomically-editableportions of hierarchically-structured documents of the particular class.4. A method in accordance with claim 3, wherein the act of convertingthe description of the schema into at least one early-bound objectcomprises an act of preserving the identification of atomically-editableportions of hierarchically-structured documents of the particular classin the early-bound object.
 5. In a computer system that has access to aservice that maintains hierarchically-structured documents of at leastone particular class, a computer program product for implementing amethod for facilitating the programming of source code wherein theprogrammer is relieved of having to track the document-specific schemaof the hierarchically-structured documents that may be called andoperated upon by the computer system when running the compiled sourcecode by permitting the computer system's processor to issue a functioncall that will interface with an early-bound object, thereby permittingthe early-bound object to adjust change tracking information that willresult in altering one of the hierarchically-structured documents of aparticular class rather than having to access the specific schema of thehierarchical document itself to do so, the computer program productcomprising computer-readable medium for carrying computer-executableinstructions for the method, and wherein the method comprises thefollowing acts: accessing a description of the schema of one or morehierarchically-structured documents of a particular class, theparticular class of hierarchically-structured documents havingproperties and methods that may be performed on thehierarchically-structured documents of the particular class, wherein atleast one of the properties includes change tracking information;converting the accessed description of the schema into at least onecorresponding early-bound object that has data fields for storing atleast some of the properties as well as at least some of the methodsthat correspond to the hierarchically-structured documents of theparticular class, wherein the early-bound object comprises the changetracking information; detecting, a property modification by receiving arequest to interface with the early-bound object in order to modify atleast one property of the at least one early-bound object as a result ofa function call from the microprocessor running the compiled program,the function call interfacing with the at least one early-bound objectrather than with the particular document description of the schema forthe one or more hierarchical documents of the particular class; causingthe at least one early-bound object that received the modificationrequest to adjust the change tracking information of the at least oneearly-bound object in response to the requested modification; andcausing the at least one early-bound object to then either directly orindirectly automatically manipulate a correspondinghierarchically-structured document of the particular class to reflectthe property modification.
 6. The computer program product in accordancewith claim 5, wherein the one or more computer-readable media arephysical storage media.
 7. A computer program product in accordance withclaim 5, wherein the corresponding hierarchically-structured document ofthe particular class comprises an eXtenstible Markup Language (XML)document.
 8. A computer program product in accordance with claim 5,wherein the description of the schema of hierarchically-structureddocuments of a particular class includes an identification ofatomically-editable portions of hierarchically-structured documents ofthe particular class.
 9. A computer program product in accordance withclaim 8, wherein the computer-executable instructions for converting thedescription of the schema into at least one early-bound object comprisecomputer-executable instruction for preserving the identification ofatomically-editable portions of hierarchically-structured documents ofthe particular class in the early-bound object.